package bit.springtransdemo.service;

import bit.springtransdemo.mapper.UserInfoMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
@Slf4j
public class UserService {
    @Autowired
    private UserInfoMapper userInfoMapper;

    @Transactional(propagation = Propagation.NESTED)
    public void registryUser( @Param("userName")String userName, @Param("password")String password) throws Exception {
        //插⼊⽤⼾信息
        try{
            int a=10/0;
        }catch(Exception e){
            log.error("算数异常",e);
        }

        userInfoMapper.insert(userName,password);
    }
}
